package com.thghh;

import com.thghh.rule.HelloWorldRule;
import com.thghh.rule.WeatherRule;
import org.jeasy.rules.api.Facts;
import org.jeasy.rules.api.Rule;
import org.jeasy.rules.api.Rules;
import org.jeasy.rules.api.RulesEngine;
import org.jeasy.rules.core.DefaultRulesEngine;
import org.jeasy.rules.core.RuleBuilder;

import javax.xml.ws.http.HTTPException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Hello world!
 *
 */
public class App {
    public static void main( String[] args ) {
        // define facts
        Facts facts = new Facts();
        facts.put("rain", true);

        // define rules
//        Rule weatherRule = new WeatherRule();
        Rules rules = new Rules(new WeatherRule(), new HelloWorldRule());

        // fire rules on known facts
        RulesEngine rulesEngine = new DefaultRulesEngine();
        rulesEngine.fire(rules, facts);



        Matcher matcher = Pattern.compile("\\d{1,2}").matcher("12月30日");
        while (matcher.find()){
            System.out.println(matcher.group(0));
        }

    }
}
